import { useUserInfo } from '@/stores/userInfo.js'
import { host, HttpRequest } from '@/common/util'
export const loginUrl = '/login/alipay'
export const sessionCodeUrl = '/conference/zfb/openId';
export const verifyCodeUrl = '/login?mobile=';
export const myConferenceUrl = '/conference/my-user'
export const paymentUrl = '/conference/payment/'
export const paiedUrl = '/conference/paymentRecord/miniOrder'
export const paiedUpdateUrl = '/conference/payment/alipay/'
export const paiedCloseUrl = '/conference/paymentRecord/miniClose'
export const orderQueryUrl = '/conference/paymentRecord/orderQuery'
export const paymentLogUrl = '/conference/userlog/'

export function paymentLog(data){
	return HttpRequest({
		url:paymentLogUrl,
		data:data,
		auth:true,
	})
}
export function orderQuery( tradeId, conferenceId){
	return HttpRequest({
		url:orderQueryUrl+'?tradeId='+tradeId+'&conferenceId='+conferenceId,
		type:'get',
		auth:true,
	})
}

export function paymentClose(conferenceId,merOrderId){
	return HttpRequest({
		url:paiedCloseUrl,
		data:{
			conferenceId: conferenceId,
			merOrderId: merOrderId
		},
		type:'post',
		auth:true,
	})
}

export function paymentUpdate(data,pid){
	return HttpRequest({
		url:paiedUpdateUrl+pid,
		type:'post',
		data:data,
		auth:true,
	})
}
export function  paymentPaied(data){
	return HttpRequest({
		url:paiedUrl,
		type:'post',
		data:data,
		auth:true,
	})
}

export function paymentPrepaied(cid,pid){
	return HttpRequest({
		url:paymentUrl+pid,
		type:'post',
		data:{conferenceId:cid},
		auth:true,
	})
}
export function myConference(cid,aid){
	return HttpRequest({
	    url: myConferenceUrl+'?conferenceId='+cid+'&accountId='+aid,
		type: 'get',
		auth:true,
	})
}
export function login(form) {
    return HttpRequest({
        url: loginUrl,
		data:form,
		auth:false,
    })
}

export function verifyCode(mobile){
	return HttpRequest({
	    url: verifyCodeUrl + mobile,
	    type: 'get',
		auth:false,
	})
}

export function sessionCode(code){
	return HttpRequest({
	    url: sessionCodeUrl,
	    type: 'get',
	    data: {
	        code: code
	    },
		auth:false,
	})
}